package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Chufenqingkuangbiao;
import com.ruoyi.system.service.IChufenqingkuangbiaoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 处分情况表Controller
 * 
 * @author Quilan
 * @date 2023-12-04
 */
@RestController
@RequestMapping("/system/chufenqingkuangbiao")
public class ChufenqingkuangbiaoController extends BaseController
{
    @Autowired
    private IChufenqingkuangbiaoService chufenqingkuangbiaoService;

    /**
     * 查询处分情况表列表
     */
    @PreAuthorize("@ss.hasPermi('system:chufenqingkuangbiao:list')")
    @GetMapping("/list")
    public TableDataInfo list(Chufenqingkuangbiao chufenqingkuangbiao)
    {
        startPage();
        List<Chufenqingkuangbiao> list = chufenqingkuangbiaoService.selectChufenqingkuangbiaoList(chufenqingkuangbiao);
        return getDataTable(list);
    }

    /**
     * 导出处分情况表列表
     */
    @PreAuthorize("@ss.hasPermi('system:chufenqingkuangbiao:export')")
    @Log(title = "处分情况表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Chufenqingkuangbiao chufenqingkuangbiao)
    {
        List<Chufenqingkuangbiao> list = chufenqingkuangbiaoService.selectChufenqingkuangbiaoList(chufenqingkuangbiao);
        ExcelUtil<Chufenqingkuangbiao> util = new ExcelUtil<Chufenqingkuangbiao>(Chufenqingkuangbiao.class);
        util.exportExcel(response, list, "处分情况表数据");
    }

    /**
     * 获取处分情况表详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:chufenqingkuangbiao:query')")
    @GetMapping(value = "/{序号}")
    public AjaxResult getInfo(@PathVariable("序号") Long 序号)
    {
        return success(chufenqingkuangbiaoService.selectChufenqingkuangbiaoBy序号(序号));
    }

    /**
     * 新增处分情况表
     */
    @PreAuthorize("@ss.hasPermi('system:chufenqingkuangbiao:add')")
    @Log(title = "处分情况表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Chufenqingkuangbiao chufenqingkuangbiao)
    {
        return toAjax(chufenqingkuangbiaoService.insertChufenqingkuangbiao(chufenqingkuangbiao));
    }

    /**
     * 修改处分情况表
     */
    @PreAuthorize("@ss.hasPermi('system:chufenqingkuangbiao:edit')")
    @Log(title = "处分情况表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Chufenqingkuangbiao chufenqingkuangbiao)
    {
        return toAjax(chufenqingkuangbiaoService.updateChufenqingkuangbiao(chufenqingkuangbiao));
    }

    /**
     * 删除处分情况表
     */
    @PreAuthorize("@ss.hasPermi('system:chufenqingkuangbiao:remove')")
    @Log(title = "处分情况表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{序号s}")
    public AjaxResult remove(@PathVariable Long[] 序号s)
    {
        return toAjax(chufenqingkuangbiaoService.deleteChufenqingkuangbiaoBy序号s(序号s));
    }
}
